<template>
  <el-button plain @click="centerDialogVisible = true">
    添加学生
  </el-button>

  <el-dialog
    v-model="centerDialogVisible"
    title="添加学生"
    width="500"
    align-center
    style="width:30vw;"
  >
    <div>
        <el-form :model="form">
            <el-form-item label="入学年份">
                <el-input v-model="form.schYear" />
            </el-form-item>
            <el-form-item label="原所在学校">
                <el-input v-model="form.school" />
            </el-form-item>
            <el-form-item label="所属学院">
                <el-input v-model="form.auth" />
            </el-form-item>
            <el-form-item label="专业">
                <el-input v-model="form.stuType" />
            </el-form-item>
            <el-form-item label="班级">
                <el-input v-model="form.classname" />
            </el-form-item>
            <el-form-item label="班主任/辅导员">
                <el-input v-model="form.teacher" />
            </el-form-item>
            <el-form-item label="校友姓名">
                <el-input v-model="form.stuName" />
            </el-form-item>
            <el-form-item label="性别">
                <el-input v-model="form.sex" />
            </el-form-item>
            <el-form-item label="单位名称">
                <el-input v-model="form.organizationName" />
            </el-form-item>
            <el-form-item label="职务/职称">
                <el-input v-model="form.office" />
            </el-form-item>
            <el-form-item label="联系电话">
                <el-input v-model="form.phone" />
            </el-form-item>
            <el-form-item label="常驻地">
                <el-input v-model="form.address" />
            </el-form-item>
            <el-form-item label="单位性质">
                <el-input v-model="form.nature" />
            </el-form-item>
            <el-form-item label="行业类型">
                <el-input v-model="form.type" />
            </el-form-item>
            <el-form-item label="备注（班级人数）">
                <el-input v-model="form.classCount" />
            </el-form-item>
        </el-form>
    </div>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="centerDialogVisible = false">取消</el-button>
        <el-button type="primary" @click="confirm">
          确定
        </el-button>
      </div>
    </template>
  </el-dialog>
</template>
<script setup>
import { reactive, ref } from 'vue'
import {addstudent} from '../../api/user'
const centerDialogVisible = ref(false)
const form = reactive({
    schYear:null,
    school:'',
    auth:'',
    stuType:'',
    classname:'',
    teacher:'',
    stuName:'',
    sex:'',
    organizationName:'',
    office:'',
    phone:'',
    address:'',
    nature:'',
    type:'',
    classCount:null

})
const confirm = () => {
    form.schYear = Number(form.schYear)
    form.classCount = Number(form.classCount)
    addstudent(form)
    centerDialogVisible.value = false
}
</script>